package flc.ast.adapter;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.ScreenOriBean;
import flc.ast.bean.ScreenRecordBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class ScreenOriAdapter extends StkProviderMultiAdapter<ScreenOriBean> {

    public ScreenOriAdapter() {
        addItemProvider(new StkSingleSpanProvider(38));
        addItemProvider(new ScreenOriProvider());
    }

    private class ScreenOriProvider extends BaseItemProvider<ScreenOriBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_screen_ori;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, ScreenOriBean bean) {
            baseViewHolder.setImageResource(R.id.ivScreenOriItemIcon, bean.getImg());
            baseViewHolder.setText(R.id.tvScreenOriItemName, bean.getName());
            if (bean.isSelected()) {
                baseViewHolder.setImageResource(R.id.ivScreenOriItemSel, R.drawable.ayyxz);
            } else {
                baseViewHolder.setImageResource(R.id.ivScreenOriItemSel, R.drawable.ayywxz);
            }
        }
    }
}
